package cn.pro.javafxlearn;

import javafx.application.Application;
import javafx.geometry.Pos;
import javafx.scene.ImageCursor;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.scene.image.Image;
import javafx.scene.layout.AnchorPane;
import javafx.stage.Stage;

public class Main4 extends Application {
    public static void main(String[] args) {
           Application.launch(args);
    }
    @Override
    public void start(Stage primaryStage) throws Exception {
             Label label=new Label("hello world");
               label.setLayoutX(200);
               label.setLayoutY(200);
               label.setStyle("-fx-background-color: red;-fx-border-color: blue;-fx-border-width: 3px");//设置背景颜色、边框颜色和边框粗细
               label.setPrefHeight(50);//设置宽高
               label.setPrefWidth(200);
               label.setAlignment(Pos.CENTER);//设置文字居中
               label.setOpacity(0.5);//设置标签的透明程度
        AnchorPane root=new AnchorPane();
          root.getChildren().addAll(label);

        Scene scene=new Scene(root,500,500);
        primaryStage.setScene(scene);
        primaryStage.show();

    }
}
